function onData(data) {
	if (!data.get('owner_data').hadError()) {
	  var owner_data = data.get('owner_data').getData();
	  document.getElementById('site-name').innerHTML = owner_data.getDisplayName();
	}
	
	var viewer_info = document.getElementById('friends-list');
	if (data.get('viewer_data').hadError()) {
	  google.friendconnect.renderSignInButton({'id':'gfc-signin','style':'text'});
	  viewer_info.innerHTML = '';
	} else {
	  document.getElementById('gfc-signin').style.display = 'none';
	  var viewer = data.get('viewer_data').getData();
	  viewer_info.innerHTML = 'Hello, ' + viewer.getDisplayName() + ' ' +
	      '<a href="#" onclick="google.friendconnect.requestSettings()">Settings</a> | ' + 
	      '<a href="#" onclick="google.friendconnect.requestInvite()">Invite</a> | ' +
	      '<a href="#" onclick="google.friendconnect.requestSignOut()">Sign out</a>';
	}
	
	if (!data.get('site_friends').hadError()) {
	  var site_friends = data.get('site_friends').getData();
	  var list = document.getElementById('friends-list');
	  list.innerHTML = '';
	  site_friends.each(function(friend) {
	    list.innerHTML += '<li>' + friend.getDisplayName() + '</li>';
	  });
	}
};